package com.study.web.controller.operate;

import cn.dev33.satoken.annotation.SaCheckLogin;

import com.study.common.core.controller.AppBaseController;
import com.study.common.core.domain.R;
import com.study.app.domain.vo.AppActivityVo;
import com.study.app.service.IAppActivityService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * App弹窗 --
 */

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/activity")
public class AppActivityUserController extends AppBaseController {

    private final IAppActivityService iAppActivityService;

    /**
     * 获取App弹窗信息
     *
     * @return
     */
    @SaCheckLogin
    @GetMapping("/getInfo")
    public R<AppActivityVo> getAppActivityInfo() {
        AppActivityVo activityVo = iAppActivityService.queryInfo();
        if (activityVo.getSourceType() == 2){
            //根据 activityVo.getSourceShopId();获取商品信息推荐图片，进行替换
            activityVo.setSourceContent(null);
        }
        return R.ok(activityVo);
    }
}
